import request from '@/utils/request'

// 获取全部的角色
export const getRoles = (page, pagesize) => {
  return request({
    url: '/sys/role',
    method: 'GET',
    // get用params;  post,put,delete用data
    params: { page, pagesize }
  })
}

// 删除角色
export const deleteRole = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'DELETE'
  })
}

// 添加角色
export const addRole = (data) => {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

export const editRole = (data) => {
  return request({
    url: '/sys/role/' + data.id,
    method: 'PUT',
    data
  })
}
